package com.ouc.openplatform.zykt.orderManage.service.impl;

import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ouc.openplatform.pojo.EUDataGridResult;
import com.ouc.openplatform.zykt.orderManage.dao.CS_OrderDao;
import com.ouc.openplatform.zykt.orderManage.model.CS_Order;
import com.ouc.openplatform.zykt.orderManage.service.CS_OrderService;

public class CS_OrderServiceImpl implements CS_OrderService{

	private CS_OrderDao orderDao;

	public CS_OrderDao getOrderDao() {
		return orderDao;
	}

	public void setOrderDao(CS_OrderDao orderDao) {
		this.orderDao = orderDao;
	}

	@Override
	public EUDataGridResult findAllOrder(String userNo,String orderNo,int page,int rows) {
		//分页处理
		PageHelper.startPage(page, rows);
		List<CS_Order> orderList = orderDao.findAllOrder(userNo,orderNo);
		
		//创建一个返回值对象
		EUDataGridResult result = new EUDataGridResult();
		result.setRows(orderList);
		//取记录总条数
		PageInfo<CS_Order> pageInfo = new PageInfo<CS_Order>(orderList);
		result.setTotal(pageInfo.getTotal());
		return result;
	}

	@Override
	public EUDataGridResult findAllEndOrder(String userNo,String orderNo, Integer orderState, int page, int rows) {
		//分页处理
		PageHelper.startPage(page, rows);
		List<CS_Order> orderList = orderDao.findAllEndOrder(userNo,orderNo, orderState);
		
		//创建一个返回值对象
		EUDataGridResult result = new EUDataGridResult();
		result.setRows(orderList);
		//取记录总条数
		PageInfo<CS_Order> pageInfo = new PageInfo<CS_Order>(orderList);
		result.setTotal(pageInfo.getTotal());
		return result;
	}
	
}
